<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
        <h1><a href="../default.html">返回主页</a></h1>
    <script>
        var a = [89,66,54,12,19,87,0,41];
        console.log('原数组为'+a+'<br>');
        for(var i=1;i<a.length;i++){
            for(var j=i;j>0;j--){
                if(a[j-1]>a[j]){
                [a[j-1],a[j]]=[a[j],a[j-1]];
                }
            }
        }
        console.log('排序后为：'+a);
    </script>
</body>
</html>